/**
 * 功能描述 卡片
 */

define(function (require, exports, module) {
	var Button = require("button");
	
    var instance = {
        initComponent : function (params, widget) {
        	var button = new Button({
        	    parentNode: ".J-button",
        	    model: {
        	        id: "addbutton",
        	        text: "新增",
        	        className:"col-md-offset-11",
        	        handler: function() {
        	        	widget.set("type",false);//用type来判断子表是新增还是修改（false是新增）
        	        	widget.get("editform").reset();
        	        	var pkProduct=widget.get("form").getValue("pkProduct");
        	        	if(pkProduct){
        	        		widget.get("editform").setValue("pkProduct",pkProduct)
        	        	}
        	            widget.show(".J-editform").hide([".J-form",".J-grid",".J-editgrid"]);
        	            $(".J-button").addClass("hidden");
        	            widget.get("subnav").hide(["cancel","save"]);
//        	            widget.get("subnav").hide(["cancel","save"]).show(["return"]);
        	        }
        	    }
        	});
            widget.set("button", button);
        }
    };
    module.exports = instance;
});
